package D240606.ThreadDemo;

public class MultipleThreadDemo {
    public static void main(String[] args) {
        /*new Thread(new Runnable() {
            @Override
            public void run() {
                StringBuffer stringBuffer = new StringBuffer("P2===");
                for (int i = 0; i < 50; i++) {
                    System.out.println(stringBuffer.append(i));
                }
            }
        }).start();

        StringBuffer stringBuffer = new StringBuffer("P1===");
        for (int i = 0; i < 50; i++) {
            System.out.println(stringBuffer.append(i));
        }*/

        new Thread(new Runnable() {
            @Override
            public void run() {
                StringBuilder stringBuffer = new StringBuilder("P2===");
                for (int i = 0; i < 50; i++) {
                    System.out.println(stringBuffer.append(i));
                }
            }
        }).start();

        StringBuilder stringBuffer = new StringBuilder("P1===");
        for (int i = 0; i < 50; i++) {
            System.out.println(stringBuffer.append(i));
        }
    }
}
